@extends('admin.layout')
@section('title',$title)

@section('content')
<!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                商品管理
                <small>添加商品</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url('/admin/index')}}"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="{{ url('/admin/shop_goods')}}">商品管理</a></li>
                <li class="active">添加</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速添加商品</h3>
                        </div><!-- /.box-header -->

                        <!-- form start -->
                        <form role="form" action="{{ url('/admin/shop_goods') }}" method="post" enctype="multipart/form-data">
                        	{{ csrf_field()}}
                            <div class="box-body">


                            @if (count($errors) > 0)
                             <div class="alert alert-danger">
                               <ul>
                             @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                            @endforeach
                              </ul>
                            </div>
                          @endif
                          <!-- 下拉框 -->
                            <div class="form-group">
                                <label for="exampleInputEmail1">类名</label>
                                <select class="form-control" name="tid">
                                @foreach($data as $row)
                                    <option value="{{ $row -> id }}">{{ $row -> name }}</option>
                                @endforeach
                                </select>
                            </div>

                                <div class="form-group">
                                    <label for="exampleInputEmail1">商品名</label>
                                    <input type="text" name="gname" class="form-control" value="{{ old('gname')}}" id="exampleInputEmail1"
                                           placeholder="请输入商品名">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">价格</label>
                                    <input type="text" name="price" class="form-control" id="exampleInputPassword1" value="{{ old('price')}}"
                                           placeholder="请输入价格">
                                </div>
                                 <div class="form-group">
                                    <label for="exampleInputPassword1">库存</label>
                                    <input type="cnt" name="cnt" class="form-control" id="exampleInputPassword1" value="{{ old('cnt')}}"
                                           placeholder="请输入库存">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputFile">图片</label>
                                    <input type="file" name="gpic" id="exampleInputFile">
                                    <p class="help-block">请选择一张图片作为你的商品.</p>
                                </div>
                                 <div class="form-group">
                                    <label for="exampleInputEmail1">商品描述</label>
                                    <input type="text" name="gdesc" class="form-control" id="exampleInputEmail1" value="{{ old('gdesc')}}"
                                           placeholder="请输入商品描述">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">商品状态</label><br>
                                    新品<input type="radio" checked name="status" value="0">
                                    上架<input type="radio" name="status" value="1">
                                    下架<input type="radio" name="status" value="2">
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">添加</button>
                            </div>
                        </form>
                    </div><!-- /.box -->


                </div><!--/.col (left) -->
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection